package com.svanberg.movielib;

import java.util.Collection;
import java.util.EnumSet;

public class Movie
{
	private String title;
	private int year;
	private Collection<Genre> genres;
	private Collection<Role> roles;
	private Director director;
	
	public Movie()
	{
		genres = EnumSet.noneOf(Movie.Genre.class);
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public Director getDirector() {
		return director;
	}

	public void setDirector(Director director) {
		if (this.director != null)
			this.director.removeMovie(this);
		this.director = director;
		this.director.addMovie(this);
	}
	
	public void addRole(Role role)
	{
		roles.add(role);
	}
	
	public Collection<Role> getRoles()
	{
		return roles;
	}
	
	public Collection<Genre> getGenres()
	{
		return genres;
	}
	
	public enum Genre
	{
		ACTION, ADVENTURE, ANIMATION, BIOGRAPHY, COMEDY, CRIME, DOCUMENTARY,
		DRAMA, FAMILY, FANTASY, HISTORY, HORROR, MUSICAL, MYSTERY, ROMANCE,
		SCIFI, SPORT, THRILLER, WAR, WESTERN;
	}
}
